package com.arcsoft.commonbase.widgets

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.recyclerview.widget.RecyclerView

class TouchRecyclerView: RecyclerView {

    private var mListener:OnTouchListener? = null

    constructor(context: Context):super(context)

    constructor(context: Context, attributeSet: AttributeSet):super(context, attributeSet)

    constructor(context: Context, attributeSet: AttributeSet, defStyle:Int):super(context, attributeSet, defStyle)

    fun addTouchListener(listener:OnTouchListener) {
        mListener = listener
    }

    override fun onTouchEvent(e: MotionEvent?): Boolean {
        mListener?.onTouch(this, e)
        return super.onTouchEvent(e)
    }
}